﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Forms;
namespace eTMS.Controls
{
    public class ComboBoxGioiTinh : ComboBoxBindingBase<object>
    {
        public override void BindData()
        {
            this.DropDownStyle = ComboBoxStyle.DropDownList;
            DataRow row;
            DataTable tblData = new DataTable();
            tblData.Columns.Add("GioiTinh_ID", typeof(int));
            tblData.Columns.Add("TenGioiTinh", typeof(string));
            if (IsAddAllItem)
            {
                row = tblData.NewRow();
                row["GioiTinh_ID"] = 3;
                row["TenGioiTinh"] = Commons.Constants.APP_ALL;
                tblData.Rows.Add(row);
            }
            if (IsAddChooseItem)
            {
                row = tblData.NewRow();
                row["GioiTinh_ID"] = 2;
                row["TenGioiTinh"] = Commons.Constants.APP_CHOOSE;
                tblData.Rows.Add(row);
            }
            row = tblData.NewRow();
            row["GioiTinh_ID"] = 1;
            row["TenGioiTinh"] = Commons.Constants.APP_MALE;
            tblData.Rows.Add(row);
            row = tblData.NewRow();
            row["GioiTinh_ID"] = 0;
            row["TenGioiTinh"] = Commons.Constants.APP_FEMALE;
            tblData.Rows.Add(row);
            this.DataSource = tblData;
            this.ValueMember = "GioiTinh_ID";
            this.DisplayMember = "TenGioiTinh";
        }
    }
}
